﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Nest;

namespace ES.Model
{
    /// <summary>
    /// 微站-文章列表
    /// </summary>
    [ElasticsearchType(Name = "MicroSites.Articles")]
    public class Article
    {
        public Article()
        {
            Tags = new List<string>();
        }

        /// <summary>
        /// 微站的id
        /// </summary>
        public long SiteId { get; set; }

        /// <summary>
        /// 微站关联
        /// </summary>
        public List<long> SiteIds { get; set; }

        /// <summary>
        /// 业务主键
        /// </summary>
        public long ArticleId { get; set; }

        /// <summary>
        /// 文章名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 所属分类
        /// </summary>
        public long CategoryId { get; set; }

        /// <summary>
        /// 文章描述(坑人 描述居然保存的是内容信息)
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 文章内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 分类名称
        /// </summary>
        public string CategoryNames { get; set; }

        /// <summary>
        /// 保留原来的分类
        /// </summary>
        [Nest.Number(Ignore = true)]
        public long OldCategoryId { get; set; }

        /// <summary>
        /// 预览的url的二维码地址
        /// </summary>
        public string PreViewQrCode { get; set; }

        /// <summary>
        /// 文章图片
        /// </summary>
        public string PicUrl { get; set; }

        /// <summary>
        /// 图片域名
        /// </summary>
        public string FileDomain { get; set; }

        /// <summary>
        /// 标签显示格式化
        /// </summary>
        public string TagsFormat
        {
            get
            {
                string tags = "";
                if (Tags.Count > 0)
                {
                    foreach (var tag in Tags)
                    {
                        if (tags != "")
                        {
                            tags += ",";
                        }
                        tags += tag;
                    }
                }
                return tags;
            }
        }
        /// <summary>
        /// 标签输入参数
        /// </summary>
        public string TagsSet { get; set; }
        /// <summary>
        ///  发布人姓名
        /// </summary>
        public string PublisherName { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        public string Mobile { get; set; }

        /// <summary>
        /// 发布人userId
        /// </summary>
        public long UserId { get; set; }

        /// <summary>
        /// nickname	用户的昵称
        /// </summary>
        public string NickName { get; set; }

        /// <summary>
        /// 微信号
        /// </summary>
        public string MicroSignal { get; set; }

        public string AppId { get; set; }

        [Nest.Number(Ignore = true)]
        public long CurrentWeiXinPublicNumId { get; set; }

        [Nest.Boolean(Ignore = true)]
        public bool IsOnlyAssociation { get; set; }

        /// <summary>
        /// 浏览量
        /// </summary>
        public int BrowseNumber { get; set; }
        /// <summary>
        /// 标签列表
        /// </summary>
        public List<string> Tags { get; set; }
        /// <summary>
        /// O2O产品Id
        /// </summary>
        public long O2OProductId { get; set; }

        /// <summary>
        /// 文章标题首字母
        /// </summary>
        public string FirstLetter { get; set; }

        /// <summary>
        /// 隐藏H5页面的公司信息
        /// </summary>
        public bool HideH5CompanyInfo { get; set; }

        /// <summary>
        /// 隐藏H5页面的创建时间
        /// </summary>
        public bool HideH5CreateTime { get; set; }
    }
}
